import { createRouter, createWebHistory } from 'vue-router'
import layout from "@/layout/index.vue";
const LoginView=()=>import("@/views/LoginView")
export const routes = [
  {
    path: '/',
    component: LoginView
  },
  {
    path: '/home',
    component: layout,
    meta: {
      title: '控制面板',
      icon: "icon-shouye"
    },
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/HomeView.vue'),
      }
    ]
  },
  {
    path: '/employee',
    component: layout,
    meta: {
      title: '人员管理',
      icon: "icon-renyuan"
    },
    children: [
      {
        path: '',
        name: 'employee',
        component: () => import('@/views/EmployeeManagerView.vue'),
      }
    ]
  },
  {
    path: '/course',
    component: layout,
    meta: {
      title: '课程管理',
      icon: "icon-kechengguanli"
    },
    children: [
      {
        path: '',
        name: 'course',
        component: () => import('@/views/CourseManagerView.vue'),
      }
    ]
  },
  {
    path: '/subject',
    component: layout,
    meta: {
      title: '知识管理',
      icon: "icon-zhishi"
    },
    children: [
      {
        path: '',
        name: 'subject',
        component: () => import('@/views/SubjectManagerView.vue'),
      }
    ]
  },
  {
    path: '/class',
    component: layout,
    meta: {
      title: '班级管理',
      icon: "icon-banjixinxi"
    },
    children: [
      {
        path: '',
        name: 'class',
        component: () => import('@/views/ClassManagerView.vue'),
        meta: {
          title: '班级列表',
        }
      },
      {
        path: '/attendance/:classId',
        name: 'AttendanceManager',
        component:  () => import('@/components/class/AttendanceManager.vue'),
        meta: {
          title: '班级列表',
        }
      },
      {
        path: '/score/:classId',
        name: 'ScoreManager',
        component:  () => import('@/components/class/ScoreManager.vue'),
        meta: {
          title: '班级列表',
        }
      },
      {
        path: '/interview/:classId/:className',
        name: 'InterviewDetail',
        component: () => import('@/components/class/interview/InterviewDetail.vue'),
        meta: {
          title: '班级列表',
        }
      },
      {
        path: '/employment/:classId/:className',
        name: 'EmploymentDetail',
        component:  () => import('@/components/class/employment/EmploymentDetail.vue'),
        meta: {
          title: '班级列表',
        }
      },
    ]
  },
  {
    path: '/student',
    component: layout,
    meta: {
      title: '学员管理',
      icon: "icon-zaiduxueyuan"
    },
    children: [
      {
        path: '',
        name: 'student',
        component: () => import('@/views/StudentManagerView.vue'),
        meta: {
          title: '学员列表',
        }
      },
      {
        path: '/student/detail/:studentId?', // 员工详情的地址
        name: 'StudentDetail',
        component: () => import('@/components/student/StudentDetail.vue'),
        meta: {
          title: '学员详情' // 显示在导航的文本
        }
      }
    ]
  },
  {
    path: '/notice',
    component: layout,
    meta: {
      title: '通知管理',
      icon: "icon-tongzhi"
    },
    children: [
      {
        path: '',
        name: 'notice',
        component: () => import('@/views/NoticeManagerView.vue'),
        meta: {
          title: '通知列表',
        }
      }
    ]
  },
  {
    path: '/permission',
    component: layout,
    meta: {
      title: '权限管理',
      icon: "icon-authority"
    },
    children: [
      {
        path: '',
        name: 'permission',
        component: () => import('@/views/PermissionManagerView.vue'),
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
